/**
 * 
 */
package com.zhang.junit;

import static org.junit.Assert.*;

import java.io.InputStream;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.Test;

import com.zhang.mappers.usermapperDao;
import com.zhang.pojo.User;

/**
 * @张博皓
 *2017年11月17日
 */
public class mapperTest {
	@Test
	public void testMapper() throws Exception {
	String resource ="sqlMapConfig.xml";
	//加载核心配置文件
	InputStream in= Resources.getResourceAsStream(resource);
	//创建sqlsession工厂
	SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(in);
	//创建sqlsession
	SqlSession sqlsession = sqlSessionFactory.openSession();
		//sqlsession生成实现类---给接口
	usermapperDao mapper = sqlsession.getMapper(usermapperDao.class);
	
	User load = mapper.load(10);
	System.out.println(load);
	

	}
}